package day10;
import java.io.*;
import java.net.*;

/**
 * @author oldliu
 * @since 1.0
 */
public class FileGet {
    public static void main(String[] args) {
        try {
            Socket socket = new Socket("localhost",8888);
            InputStream in = socket.getInputStream();
            FileOutputStream fileOutputStream = new FileOutputStream("E:/ex.png");
            int reply ;
            while ((reply=in.read())!=-1){
                fileOutputStream.write(reply);
            }
            fileOutputStream.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
